package logics

var LogicTpl = `
package logic

import (
    "context"
    "go.opentelemetry.io/otel"
    "video/proto/pb"
    "{{.App}}/srv/internal/model/dao"
    "{{.App}}/srv/internal/model/po"
)

type UserServer struct {
    pb.UnimplementedVisrvServer
}

func (u *UserServer) AddUsers(ctx context.Context, in *pb.AddUsersReq) (*pb.AddUsersResp, error) {
    var tracer = otel.Tracer("goods")

    ctx, span := tracer.Start(ctx, "goods_gorm")

    defer span.End()

    user := po.User{
        Name: in.Name,
        Age:  int(in.Age),
    }

    err := dao.UserAdd(&user, ctx)
    if err != nil {
        return nil, err
    }

    return &pb.AddUsersResp{}, nil
}
`
